package org.example.strategy;

import java.util.HashSet;
import java.util.Set;

/**
 * @author zhaokuii11@163.com
 * @create 2021-12-06 9:20
 * @Description
 */
public class Customer {
    private Integer customerId;
    private String customerName;
    /*
     * 1. 需要集合进行初始化，可以防止空指针异常
     * 2. 声明集合类型时，需要使用接口类型，因为 hibernate在获取集合类型时
     * ==》返回的时 hibernate 内置的集合类型，而不是 javaSE一个标准集合实现。
     * */
    private Set<Order> orders = new HashSet<>();

    public Customer(Integer customerId, String customerName, Set<Order> orders) {
        this.customerId = customerId;
        this.customerName = customerName;
        this.orders = orders;
    }

    public Set<Order> getOrders() {
        return orders;
    }

    public void setOrders(Set<Order> orders) {
        this.orders = orders;
    }

    public Customer() {
    }

    @Override
    public String toString() {
        return "Customer{" +
                "customerId=" + customerId +
                ", customerName='" + customerName + '\'' +
                '}';
    }

    public Customer(Integer customerId, String customerName) {
        this.customerId = customerId;
        this.customerName = customerName;
    }

    public Integer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Integer customerId) {
        this.customerId = customerId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }
}
